/**
 * @file       LCDApplication.cpp
 * @brief      TODO
 * @author     Huabo Zheng
 * @date       Feb 3, 2012
 * @Copyright  2012, www.netgear.com Inc. All rights reserved.
 */

#include "LCDApplication.h"
#include "MainPanel.h"
#include "errorcode.h"
#include "Panel.h"
#include "KeyboardListener.h"

using namespace NS_LCD_AFW;

CLCDApplication::CLCDApplication()
{
}

CLCDApplication::~CLCDApplication()
{
	if (NULL != m_pMainPanel)
	{
		OBJ_DESTORY(m_pMainPanel);
	}
}

CPanel *CLCDApplication::GetMainPanel()
{
	return m_pMainPanel;
}

int CLCDApplication::onInitInstance()
{
	int iRet = ERR_SUCCESS;
	OBJ_NEW(CMainPanel, m_pMainPanel);
	if (NULL == m_pMainPanel)
	{
		return ERR_NO_MEMORY;
	}

	if (ERR_SUCCESS != (iRet = m_pMainPanel->create("MainPanel")))
	{
		OBJ_DESTORY(m_pMainPanel);
		return iRet;
	}

	return m_pMainPanel->show();
}


int CLCDApplication::onExitInstance()
{
	return ERR_SUCCESS;
}

